home *** CD-ROM | disk | FTP | other *** search
/ Apple Reference & Presen…tion Library 2 (Reseller) / Apple R&P Lib Reseller v2.0.iso / 4-Fonts & Software / Demo Software / AppMaker / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpC_202_Globals.txt < prev    next >
Encoding:
Text File  |  1989-04-09  |  1.5 KB  |  90 lines

  1. # (decoded with TMPL 13671)
  2. /* %filename% */
  3. /* Created %date% %time% by AppMaker */
  4.  
  5. %If MPW%
  6. #include <Types.h>
  7. #include <Quickdraw.h>
  8. #include <Controls.h>
  9. #include <Dialogs.h>
  10. #include <Events.h>
  11. #include <Lists.h>
  12. #include <Menus.h>
  13. #include <TextEdit.h>
  14.  
  15. %end if%
  16. #include "%unitname%.h"
  17.  
  18. #define nil        0L
  19.  
  20. /*Standard vars:*/
  21. Boolean            quittingTime;                             
  22. EventRecord        curEvent;                          
  23. WindowPtr        curWindow;
  24. WinInfoPtr        cur;
  25. Boolean            inBackground;
  26.  
  27. WinInfoRec        noCur;
  28. %If MPW%
  29.  
  30. #pragma segment %unitname%
  31. %end if% 
  32.  
  33. /*----------*/
  34. void InitGlobals ()
  35. {
  36.     curWindow = nil;
  37.     noCur.text = nil;
  38.     noCur.vScroll = nil;
  39.     noCur.hScroll = nil;
  40.     noCur.fileNum = 0;
  41.     noCur.volNum = 0;
  42.     noCur.dirty = false;
  43.     noCur.windowKind = noWindow;
  44.     cur = &noCur;
  45. } /*InitGlobals*/
  46.  
  47. /*----------*/
  48. void SetInfo (window)
  49. WindowPtr        window;
  50. {
  51.     WinInfoPtr        infoPtr;
  52.  
  53.     if (window != curWindow) {
  54.         curWindow = window;
  55.         if (curWindow != nil) {
  56.             infoPtr = (WinInfoPtr) GetWRefCon (curWindow);
  57.             cur = infoPtr;
  58.         } else {
  59.             cur = &noCur;
  60.         } /*if*/
  61.     } /*if*/
  62. } /*SetInfo*/
  63.  
  64. /*----------*/
  65. void SetNewInfo (window)
  66. WindowPtr        window;
  67. {
  68.     WinInfoPtr        infoPtr;
  69.  
  70.     infoPtr = (WinInfoPtr) NewPtr (sizeof (WinInfoRec));
  71.     SetWRefCon (window, (long) infoPtr);
  72.     SetInfo (window);
  73. } /*SetNewInfo*/
  74.  
  75. /*----------*/
  76. void DiscardInfo (window)
  77. WindowPtr        window;
  78. {
  79.     WinInfoPtr        infoPtr;
  80.  
  81.     if (window == curWindow) {
  82.         SetInfo (nil);
  83.     }
  84.     infoPtr = (WinInfoPtr) GetWRefCon (window);
  85.     DisposPtr ((Ptr) infoPtr);
  86.     HideWindow (window);
  87.     DisposeWindow (window);
  88. } /*DiscardInfo*/
  89.  
  90.